1387a41cbea2dee9db0072766f53e2e0fe62893a,speedviewlib/src/main/java/com/github/anastr/speedviewlib/PointerSpeedometer.java,PointerSpeedometer,updateBackgroundBitmap,#,162
Before Change
textPaint.setTextAlign(Paint.Align.RIGHT);
c.save();
c.rotate(getStartDegree() + 90f, getWidth()/2f, getHeight()/2f);
c.rotate(-(getStartDegree() + 90f), getWidth()/2f - textPaint.getTextSize(), textPaint.getTextSize());
c.drawText("00", getWidth()/2f - textPaint.getTextSize(), textPaint.getTextSize(), textPaint);
c.restore();
if (getEndDegree()%360 <= 90)
textPaint.setTextAlign(Paint.Align.RIGHT);
else if (getEndDegree()%360 <= 180)
textPaint.setTextAlign(Paint.Align.LEFT);
else if (getEndDegree()%360 <= 270)
textPaint.setTextAlign(Paint.Align.CENTER);
else
textPaint.setTextAlign(Paint.Align.RIGHT);
c.save();
c.rotate(getEndDegree() + 90f, getWidth()/2f, getHeight()/2f);
c.rotate(-(getEndDegree() + 90f), getWidth()/2f + textPaint.getTextSize(), textPaint.getTextSize());
String maxSpeed = String.format(Locale.getDefault(), "%d", getMaxSpeed());
c.drawText(maxSpeed, getWidth()/2f + textPaint.getTextSize(), textPaint.getTextSize(), textPaint);
c.restore();
float unitTextPadding = dpTOpx(1);
After Change
initDraw();
backgroundBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(backgroundBitmap);
c.drawCircle(getWidth()/2f, getHeight()/2f, getWidth()/2f - padding, circleBackPaint);
c.save();
c.rotate(90f + getStartDegree(), getWidth()/2f, getHeight()/2f);
float everyDegree = (getEndDegree() - getStartDegree()) * .111f;
for (float i = getStartDegree(); i < getEndDegree()-(2f*everyDegree); i+=everyDegree) {
c.rotate(everyDegree, getWidth()/2f, getHeight()/2f);
c.drawPath(markPath, markPaint);
}
c.restore();
if (getStartDegree()%360 <= 90)
textPaint.setTextAlign(Paint.Align.RIGHT);
else if (getStartDegree()%360 <= 180)
textPaint.setTextAlign(Paint.Align.LEFT);
else if (getStartDegree()%360 <= 270)
textPaint.setTextAlign(Paint.Align.CENTER);
else
textPaint.setTextAlign(Paint.Align.RIGHT);
c.save();
c.rotate(getStartDegree() + 90f, getWidth()/2f, getHeight()/2f);
c.rotate(-(getStartDegree() + 90f), getWidthPa()/2f - textPaint.getTextSize() + padding, textPaint.getTextSize() + padding);
String minSpeed = String.format(Locale.getDefault(), "%d", getMinSpeed());
c.drawText(minSpeed, getWidthPa()/2f - textPaint.getTextSize() + padding, textPaint.getTextSize() + padding, textPaint);
c.restore();
if (getEndDegree()%360 <= 90)
textPaint.setTextAlign(Paint.Align.RIGHT);
else if (getEndDegree()%360 <= 180)
textPaint.setTextAlign(Paint.Align.LEFT);
else if (getEndDegree()%360 <= 270)
textPaint.setTextAlign(Paint.Align.CENTER);
else
textPaint.setTextAlign(Paint.Align.RIGHT);
c.save();
c.rotate(getEndDegree() + 90f, getWidth()/2f, getHeight()/2f);
c.rotate(-(getEndDegree() + 90f), getWidthPa()/2f + textPaint.getTextSize() + padding, textPaint.getTextSize() + padding);
String maxSpeed = String.format(Locale.getDefault(), "%d", getMaxSpeed());
c.drawText(maxSpeed, getWidthPa()/2f + textPaint.getTextSize() + padding, textPaint.getTextSize() + padding, textPaint);
c.restore();
float unitTextPadding = dpTOpx(1);